package com.jjlin.chapter_1;

import java.util.*;
public class CD7{

    public static int getAndRemoveLastElement(Stack<Integer> stack){
        int res = stack.pop();
        if(stack.isEmpty())
            return res;
        else{
            int last = getAndRemoveLastElement(stack);
            stack.push(res);
            return last;
        }
    }

    public static void reverse(Stack<Integer> stack){
        if(stack.isEmpty())
            return;
        int element = getAndRemoveLastElement(stack);
        reverse(stack);
        stack.push(element);
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Stack<Integer> stack = new Stack<>();
        Stack<Integer> resStack = new Stack<>();//为了使输出和题目一样使用栈（这道题的输出属实有毒）
        while(n-- > 0){
            int num = sc.nextInt();
            stack.push(num);
        }
        reverse(stack);
        while(!stack.isEmpty())
            resStack.push(stack.pop());
        while(!resStack.isEmpty())
            System.out.print(resStack.pop() + " ");
    }
}